//
//  AdvertisementTableViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/3.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "AdvertisementTableViewCell.h"

@interface AdvertisementTableViewCell ()

@property (strong, nonatomic) UIImageView *adverIV;

@end

@implementation AdvertisementTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView addSubview:self.adverIV];
        
    }
    
    return self;
}


- (void)adverGestureClick:(UIGestureRecognizer *)recognizer {
   
    NSLog(@"图片点击事件");
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [self.adverIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY);
        make.width.mas_equalTo(jisuan(710));
        make.height.mas_equalTo(jisuan(240));
        
    }];
    
}

#pragma mark -lazy
- (UIImageView *)adverIV {
    
    if (!_adverIV) {
        
        _adverIV = [[UIImageView alloc] init];
        _adverIV.contentMode = UIViewContentModeScaleAspectFit;
        _adverIV.backgroundColor = Colorf2f2f2;
        
        _adverIV.userInteractionEnabled = YES;
        UITapGestureRecognizer *adverGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(adverGestureClick:)];
        [_adverIV addGestureRecognizer:adverGesture];
        
    }
    
    return _adverIV;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
